﻿using System;
using System.Collections.Generic;
using Color = System.Drawing.Color;
using SwinGame;

namespace Gundam_2._0_Alpha.src
{
    public class CreateMenuButtons
    {
        public List<Button> CreateButtons(string sourceFile,int textPostXStart,int textPostYStart,int incrementY, int maxLength)
        {
            string[] textFile = System.IO.File.ReadAllLines((Resources.PathToResource(sourceFile)));

            List<Button> tempButtonList = new List<Button>();
            Button tempButton;
            bool active = true;

            if (maxLength == 0) maxLength = textFile.Length;

            for (int i = 0; i < maxLength; i++)
            {
                tempButton = new TextButton(KeyCode.vk_RETURN, textFile[i], textPostXStart, textPostYStart, active);
                textPostYStart += incrementY;
                active = false;
                tempButtonList.Add(tempButton);
            }

            for (int i = 0; i < tempButtonList.Count; i++)
            {
                if (i != 0)
                    tempButtonList[i].PreviousButton = tempButtonList[i - 1];
                if (i < tempButtonList.Count - 1)
                    tempButtonList[i].NextButton = tempButtonList[i + 1];
            }

            return tempButtonList;
        }
    }
}
